//
//  PicPickerCell.swift
//  JGWB
//
//  Created by 付建国 on 2016/10/19.
//  Copyright © 2016年 sher. All rights reserved.
//

import UIKit

class PicPickerCell: UICollectionViewCell {
    // MARK:- 定义属性
    var image : UIImage?{
        didSet{
            if image != nil{
                imageV.image = image
                photoBtn.isUserInteractionEnabled = false
                deletePhotoBtn.isHidden = false
            }else{
                imageV.image = nil
                photoBtn.isUserInteractionEnabled = true
                deletePhotoBtn.isHidden = true
            }
        }
    }
    @IBOutlet weak var photoBtn: UIButton!
    @IBOutlet weak var deletePhotoBtn: UIButton!
    @IBOutlet weak var imageV: UIImageView!
   
    // MARK:- 事件监听
    @IBAction func addPhotoClick(_ sender: AnyObject) {
        
        NotificationCenter.default.post(name: NSNotification.Name(rawValue: PicPickerAddPhotoNote), object: nil)
        
    }
    @IBAction func deletePhotoClick(_ sender: AnyObject) {
         NotificationCenter.default.post(name: NSNotification.Name(rawValue: PicPickerDeletePhotoNote), object: imageV.image)
    }
    
}
